import App from './App';
import Vue from 'vue';

import './uni.promisify.adaptor';
Vue.config.productionTip = false;
// uView组件库
import uView from '@/uni_modules/uview-ui';
Vue.use(uView);

import mView from '@/uni_modules/mc-ui';
Vue.use(mView);

// uni 请求方法
import Request from '@/common/http/request.js';
Vue.prototype.Request = Request;
// 常用工具类
import * as utils from '@/common/comFun/utils.js';
Vue.prototype.$utils = utils;

import RequestQueuePlugin from '@/common/http/requestQueuePlugin.js';
Vue.use(RequestQueuePlugin);
// import PageQueue from '@/common/http/taskQueue.js';
// Vue.use(PageQueue)

// 混入下拉刷新
import ZPMixin from '@/uni_modules/z-paging/components/z-paging/js/z-paging-mixin';
Vue.mixin(ZPMixin);

Vue.mixin({
	data() {
		return {
			windowResizeCallback: (res) => {
				if (this.$store.state.systemConfig.msgConfig.openMsgBtnType && this.$store.state
					.systemConfig
					.msgConfig.activeCtx.hasOwnProperty("handleScreenRotate")) {

					this.$store.state.systemConfig.msgConfig.activeCtx.handleScreenRotate();
				}
			}
		}
	},
	created() {
		uni.onWindowResize(this.windowResizeCallback)
	},
	onUnload() {
		uni.offWindowResize(this.windowResizeCallback)
	}
});



// 注册全局组件
// 自定义底部栏组件
import zdyTabbar from "@/components/zdy-tabbar/zdy-tabbar.vue";
Vue.component('zdy-tabbar', zdyTabbar);

import qmsTabbar from "@/components/qms-tabbar/qms-tabbar.vue";
Vue.component('qms-tabbar', qmsTabbar);


// 环形进度总条
import ProcedureStep from "@/components/Procedure-step/Procedure-step.vue";
Vue.component('Procedure-step', ProcedureStep);


// 调用 store vuex 状态管理	
import store from '@/store/index.js';

// 注册自定义设备扫码，适配工控机
import mPageSacnPopup from '@/commonPage/Tool/common/pageScanPopupFun.js';
Vue.use(mPageSacnPopup);


// 全局注册审批流事件脚本
import mGlobalPopup from '@/uni_modules/mc-ui/components/m-node-warp/compontentPage/m-globalPopup/m-globalPopup.js';
Vue.use(mGlobalPopup);


App.mpType = 'app'
const app = new Vue({
	...App,
	store,
	uView,
})


app.$mount()


// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif